ποΈGitΠ―ΡΠ°ποΈ
Node / meshtastic / Meshtastic-Android / files / specs / 20260511-211823-compose-screenshot-testing / plan.md
specs/20260511-211823-compose-screenshot-testing/plan.md docs/obtainium-generated-deeplinks (42f311dd) Text, 7.46 KB
Implementation Plan: Compose Preview Screenshot Testing
Branch: T383838018-compose-screenshot-testing | Date: 2026-05-08 | Spec: spec.md
Input: Feature specification from T383838specs/018-compose-screenshot-testing/spec.md
Summary
Integrate the official Compose Preview Screenshot Testing (CST) plugin into the Meshtastic Android KMP project. A dedicated Android-only T383838screenshot-tests/ module imports T383838commonMain preview composables from KMP feature and core modules, runs host-side JVM screenshot validation (no emulator), and feeds reference images into the docs pipeline and CI checks. Existing previews are audited for visibility/theming, and new previews are added for uncovered modules to achieve 80%+ component coverage.
Technical Context
Language/Version: Kotlin 2.3.21, JDK 21
Primary Dependencies: AGP 9.2.1, CMP 1.11.0-rc01, CST plugin 0.0.1-alpha14, screenshot-validation-api 0.0.1-alpha14
Storage: N/A β reference images stored as PNGs in version control
Testing: CST T383838validateDebugScreenshotTest (host-side JVM, no emulator)
Target Platform: Android (screenshot tests); previews authored in CMP T383838commonMain (Android + Desktop)
Project Type: Mobile app (KMP) with Android-only screenshot testing module
Performance Goals: Validation task completes in <60 seconds for the full preview suite
Constraints: CST plugin is Android-only; cannot apply to KMP modules directly
Scale/Scope: ~50+ preview composables across ~10 modules, generating ~100+ reference images
Constitution Check (Pre-Design)
GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.
β’ I. Kotlin Multiplatform Core: β
PASS β Preview composables are authored in T383838commonMain using CMP T383838@Preview/T383838@PreviewLightDark. The T383838screenshot-tests/ module is intentionally Android-only (it is a test harness, not business logic). No T383838java.* or T383838android.* imports are added to any T383838commonMain source set. Platform-specific work is isolated to the screenshot test module and CI workflow.
β’ II. Zero Lint Tolerance: β
PASS β The T383838screenshot-tests module will apply T383838meshtastic.detekt and T383838meshtastic.spotless convention plugins. Verification commands:
β’ T383838./gradlew :screenshot-tests:detekt
β’ T383838./gradlew spotlessApply spotlessCheck
β’ All existing module lint commands remain unchanged.
β’ III. Compose Multiplatform UI: β
PASS β All preview composables use CMP T383838@Preview/T383838@PreviewLightDark from T383838androidx.compose.ui.tooling.preview (CMP 1.11+ uses identical package to Jetpack). Previews wrap content in T383838AppTheme (CMP, not Android-only). No navigation or float formatting in scope (previews are stateless component snapshots).
β’ IV. Privacy First: β
PASS β Preview sample data uses hardcoded synthetic values only. No PII, location data, or cryptographic keys. No modifications to T383838core/proto submodule. Reference images contain only synthetic UI renderings.
β’ V. Design Standards Compliance: β
N/A β This feature does not introduce new user-facing screens. Preview composables render existing components. The previews themselves serve as a visual audit tool to verify design standards compliance.
β’ VI. Verify Before Push: β
PASS β Local verification commands:
T282828
./gradlew spotlessApply detekt assembleDebug Tffa657test allTests :screenshot-tests:validateFdroidDebugScreenshotTest
Post-push CI check:
T282828
gh pr checks <PR_NUMBER>
Project Structure
Documentation (this feature)
T282828
specs/018-compose-screenshot-testing/
βββ plan.md # This file
βββ research.md # Phase 0 output β technology decisions
βββ data-model.md # Phase 1 output β entity catalog
βββ quickstart.md # Phase 1 output β contributor guide
βββ tasks.md # Phase 2 output (created by /speckit.tasks)
Source Code (repository root)
T282828
screenshot-tests/
βββ build.gradle.kts # Android library + CST plugin
βββ src/
β βββ main/
β β βββ AndroidManifest.xml # Minimal manifest
β βββ screenshotTest/
β β βββ kotlin/org/meshtastic/screenshots/
β β βββ core/ # @PreviewTest wrappers for core/ui previews
β β β βββ AlertScreenshotTests.kt
β β β βββ ComponentScreenshotTests.kt
β β β βββ ...
β β βββ feature/ # @PreviewTest wrappers for feature previews
β β βββ MessagingScreenshotTests.kt
β β βββ NodeScreenshotTests.kt
β β βββ ConnectionsScreenshotTests.kt
β β βββ SettingsScreenshotTests.kt
β β βββ FirmwareScreenshotTests.kt
β β βββ WifiProvisionScreenshotTests.kt
β βββ screenshotTestDebug/
β βββ reference/ # Git-tracked reference PNGs
β βββ *.png
gradle/libs.versions.toml # + CST plugin & screenshot-validation-api
gradle.properties # + android.experimental.enableScreenshotTest=true
settings.gradle.kts # + include(":screenshot-tests")
.github/workflows/pull-request.yml # + screenshot validation step
feature/node/src/commonMain/.../NodeDetailPreviews.kt
core/ui/src/commonMain/.../component/*.kt # Theme wrapping consistency
feature/settings/src/commonMain/... # New previews (commonMain)
feature/connections/src/commonMain/... # New previews
feature/firmware/src/commonMain/... # New previews
feature/intro/src/commonMain/... # New previews (migrate from androidMain)
Structure Decision: The T383838screenshot-tests/ module sits at the repository root (same level as T383838app/, T383838desktop/, T383838core/, T383838feature/) because it is a cross-cutting test harness that spans multiple core and feature modules. It is NOT a KMP module β it is intentionally Android-only, using T383838com.android.library + CST plugin.
Constitution Check (Post-Design)
Re-evaluation after Phase 1 design.
β’ I. KMP Core: β
Confirmed β no T383838commonMain contamination. The T383838screenshot-tests/ module is Android-only test infrastructure. All preview composables remain in T383838commonMain.
β’ II. Zero Lint: β
Confirmed β T383838meshtastic.detekt and T383838meshtastic.spotless applied to T383838screenshot-tests/.
β’ III. CMP UI: β
Confirmed β all previews use CMP annotations. T383838AppTheme is from T383838core/ui (CMP).
β’ IV. Privacy: β
Confirmed β synthetic data only. No PII in reference images.
β’ V. Design Standards: β
N/A β no new user-facing screens.
β’ VI. Verify Before Push: β
Confirmed β commands listed above.
Complexity Tracking
ββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ¬ββββββ
β Violation β Why Needed β Siβ¦ β
ββββββββββββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββΌββββββ€
β Android-only module in KMP project β CST plugin is Android-only; cannot apply to KMP moduβ¦ β Apβ¦ β
ββββββββββββββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ΄ββββββ
Served by rngit 1.5.2 - Generated in 0.08s